#!/bin/bash
#
#配置yum源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
#安装基本应用软件
yum install vim net-tools wget bash-completion  psmisc unzip nypdate bzip2 tree git -y
#替换epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
#关闭selinx
sed -ri  's|^SELINUX=|SELINUX=disabled|' /etc/selinux/config
#关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
systemctl mask firewalld
ndoe=$(systemctl status firewalld | awk '/Active:/ {print $2}')
if [ $ndoe == "inactive" ];then
   echo "防火墙已经关闭"
else
   echo "关闭失败"
   exit 1
fi
#时间同步
yum install ntp  ntpdate  -y
systemctl start ntpd
systemctl enable ntpd
ntpdate -u  ntp.aliyun.com

#多级目录以及换行输入
echo 'export PS1="\n\[\e[1;32m\][\u@\h \w]\[\e[0m\]\n# "' >> ~/.bashrc
source ~/.bashrc
#Tap缩进四格
cat >> ~/.vimrc << 'EOF'

set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
EOF

#倒计时
delay=10

echo "开始倒计时 ${delay} 秒..."
for ((i=delay; i>=1; i--))
do
    printf "\r等待: %2d 秒" $i
    sleep 1
done
printf "\r配置完成，开始重启虚拟机...\n"
init 6

